Change in openvpn[master]: tunnel_server(): close correct inotify fd
A message that is not in the archive (sent off-list or not yet received): gerrit.1769550961000.Iabc117848ad7b67d240c392f1a6aa2d7531fd5bb@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1497?usp=email
to review the following change.
Change subject: tunnel_server(): close correct inotify fd
......................................................................
tunnel_server(): close correct inotify fd
On a full SIGUSR1 restart of a p2mp server compiled with --enable-async-push, tunnel_server() will try to close and reopen the "inotify" control file descriptor. For whatever reason, the original code referenced the wrong context, always closing fd 0.
As a consequence of this, on the second SIGUSR1 restart, the server will close() the first active socket file descriptor, and if there are active DCO clients, the resulting event confusion will lead to an ASSERT(!mi->halt).
Fix by closing the correct FD. Add logging.
Github: fixes OpenVPN/openvpn#966
---
M src/openvpn/multi.c
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/97/1497/1
src/openvpn/multi.c +3 -1
@@ -4244,7 +4244,9 @@tunnel_server_loop (&multi);#ifdef ENABLE_ASYNC_PUSH -close (top->c2.inotify_fd); +msg (D_LOW ,"%s: close multi.top.c2.inotify_fd (%d)" , + __func__, multi.top.c2.inotify_fd ); +close (multi.top.c2.inotify_fd);#endif /* shut down management interface */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1497?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabc117848ad7b67d240c392f1a6aa2d7531fd5bb
Gerrit-Change-Number: 1497
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: cron2.
plaisthos has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1497?usp=email )
Change subject: tunnel_server(): close correct inotify fd
......................................................................
Patch Set 1: Code-Review+2
(2 comments)
File src/openvpn/multi.c:
http://gerrit.openvpn.net/c/openvpn/+/1497/comment/079de3b1_4b96fdc7?usp=email :
PS1, Line 4237: multi.top.c2.inotify_fd = inotify_init();
We set inotify_fd here in (multi->top, which is also CM_TOP_CLONE) instead of top which is CM_TOP.
We should probably rename top in this function to something like root_top or something else to avoid the confusion between multi->top and the local top variable.
http://gerrit.openvpn.net/c/openvpn/+/1497/comment/de71ce2b_74df9b13?usp=email :
PS1, Line 4247: close(top->c2.inotify_fd);
and then we close top of the other context.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1497?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabc117848ad7b67d240c392f1a6aa2d7531fd5bb
Gerrit-Change-Number: 1497
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Wed, 28 Jan 2026 10:58:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
PATCH 1/1 tunnel_server(): close correct inotify fd
In reply to a message not in the archiveOn a full SIGUSR1 restart of a p2mp server compiled with --enable-async-push, tunnel_server() will try to close and reopen the "inotify" control file descriptor. For whatever reason, the original code referenced the wrong context, always closing fd 0.
As a consequence of this, on the second SIGUSR1 restart, the server will close() the first active socket file descriptor, and if there are active DCO clients, the resulting event confusion will lead to an ASSERT(!mi->halt).
Fix by closing the correct FD. Add logging.
Github: fixes OpenVPN/openvpn#966
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1497
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1497
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>
src/openvpn/multi.c +3 -1
@@ -4244,7 +4244,9 @@tunnel_server_loop (&multi);#ifdef ENABLE_ASYNC_PUSH -close (top->c2.inotify_fd); +msg (D_LOW ,"%s: close multi.top.c2.inotify_fd (%d)" , + __func__, multi.top.c2.inotify_fd ); +close (multi.top.c2.inotify_fd);#endif /* shut down management interface */
[Openvpn-devel] [PATCH applied] Re: tunnel_server(): close correct inotify fd
This was an... interesting chase. It started out by testing the fix for a management-interface weirdness (commit 4bf05d487c) and all of a sudden I had the server crash with ASSERT(!mi->halt) on me... which turned out to be a bug in really ancient code... (commit 619c3e9a0 moved around the inotify stuff in the context of multisocket, but did not introduce the confusion on "top" contexts - that was already in the initial inotify commit 0d1a75bfe). Full details in the github issue...
For now, this patch has been applied to the master branch (to progress towards 2.7_rc6). I will come back here to see which branches need the fix, or whether different "top context" handling actually made it do the right thing 10 years ago...
commit 5521872f80313060b659c27c55df2a6fdb74ec7a
Author: Gert Doering Date: Wed Jan 28 12:04:19 2026 +0100
tunnel_server(): close correct inotify fd
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1497
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35478.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Re: [Openvpn-devel] [PATCH applied] Re: tunnel_server(): close correct inotify fd
Hi,
Quoted 4 lines · Gert Doering
For now, this patch has been applied to the master branch (to progress towards 2.7_rc6). I will come back here to see which branches need the fix, or whether different "top context" handling actually made it do the right thing 10 years ago...
As it turns out, the code in 2.6 and earlier does not have a "multi.c", but instead it has "mudp.c" and "mtcp.c" for UDP and TCP servers, respectively.
The code is the same, the "close(0)" is the same, but the patch cannot be "just cherrypicked", so I've put a 2.6 patch to gerrit
http://gerrit.openvpn.net/c/openvpn/+/1499
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1497?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
Change subject: tunnel_server(): close correct inotify fd
......................................................................
tunnel_server(): close correct inotify fd
On a full SIGUSR1 restart of a p2mp server compiled with --enable-async-push, tunnel_server() will try to close and reopen the "inotify" control file descriptor. For whatever reason, the original code referenced the wrong context, always closing fd 0.
As a consequence of this, on the second SIGUSR1 restart, the server will close() the first active socket file descriptor, and if there are active DCO clients, the resulting event confusion will lead to an ASSERT(!mi->halt).
Fix by closing the correct FD. Add logging.
Github: fixes OpenVPN/openvpn#966
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1497
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35478.html
---
M src/openvpn/multi.c
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/97/1497/2
src/openvpn/multi.c +3 -1
@@ -4244,7 +4244,9 @@tunnel_server_loop (&multi);#ifdef ENABLE_ASYNC_PUSH -close (top->c2.inotify_fd); +msg (D_LOW ,"%s: close multi.top.c2.inotify_fd (%d)" , + __func__, multi.top.c2.inotify_fd); +close (multi.top.c2.inotify_fd);#endif /* shut down management interface */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1497?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabc117848ad7b67d240c392f1a6aa2d7531fd5bb
Gerrit-Change-Number: 1497
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1497?usp=email )
Change subject: tunnel_server(): close correct inotify fd
......................................................................
tunnel_server(): close correct inotify fd
On a full SIGUSR1 restart of a p2mp server compiled with --enable-async-push, tunnel_server() will try to close and reopen the "inotify" control file descriptor. For whatever reason, the original code referenced the wrong context, always closing fd 0.
As a consequence of this, on the second SIGUSR1 restart, the server will close() the first active socket file descriptor, and if there are active DCO clients, the resulting event confusion will lead to an ASSERT(!mi->halt).
Fix by closing the correct FD. Add logging.
Github: fixes OpenVPN/openvpn#966
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1497
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35478.html
---
M src/openvpn/multi.c
1 file changed, 3 insertions(+), 1 deletion(-)
src/openvpn/multi.c +3 -1
@@ -4244,7 +4244,9 @@tunnel_server_loop (&multi);#ifdef ENABLE_ASYNC_PUSH -close (top->c2.inotify_fd); +msg (D_LOW ,"%s: close multi.top.c2.inotify_fd (%d)" , + __func__, multi.top.c2.inotify_fd); +close (multi.top.c2.inotify_fd);#endif /* shut down management interface */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1497?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabc117848ad7b67d240c392f1a6aa2d7531fd5bb
Gerrit-Change-Number: 1497
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>